/**
 * Created by Administrator on 2017/4/25 0025.
 */
var Page0={
    create:function () {
        var page={};

        page.ui=new PIXI.DisplayObjectContainer();
        var bg=new PIXI.Graphics();
        bg.beginFill(0x0,0.3);
        bg.drawRect(0,0,740,180);
        bg.endFill();
        bg.y=475;
        page.ui.addChild(bg);

        var t0=Easy.CreateSprite('assets/images/p0_0.png',370,564,0.5,0.5,0);
        page.ui.addChild(t0);
        var t1=Easy.CreateSprite('assets/images/p0_1.png',370,564,0.5,0.5,0);
        page.ui.addChild(t1);
        var t2=Easy.CreateSprite('assets/images/p0_2.png',370,564,0.5,0.5,0);
        page.ui.addChild(t2);
        var click=Easy.CreateSprite('assets/images/click.png',370,680,0.5,0.5,0);
        page.ui.addChild(click);
        t1.on('pointerdown',downHandler);
        click.on('pointerdown',downHandler);

        page.In=function () {
            bg.alpha=0;
            TweenMax.to(bg,1,{delay:1,alpha:1,ease:Linear.easeNone});

            t0.alpha=0;
            t1.alpha=0;
            t2.alpha=0;
            TweenMax.to(t2,1,{delay:1,alpha:1});
            TweenMax.to(t2,1,{delay:5.5,alpha:0});
            TweenMax.to(t0,1,{delay:5.5,alpha:1});

            TweenMax.to(bg,0.5,{delay:9.5,y:462,alpha:1})
            TweenMax.to(bg.scale,0.5,{delay:9.5,y:1.6})
            TweenMax.to(click,0.5,{delay:9.5,alpha:1})
            TweenMax.to(click.scale,0.6,{delay:9.5,x:0.8,y:0.8,repeat:-1,yoyo:true,ease:Cubic.easeInOut})

            TweenMax.to(t0,1.5,{delay:9.5,alpha:0});
            TweenMax.to(t1,1.5,{delay:9.5,alpha:1,onComplete:function () {
                t1.interactive=true;
                click.interactive=true;

            }});

        }

        page.Out=function () {
            t1.interactive=false;
            click.interactive=false;
            TweenMax.killTweensOf(t0);
            TweenMax.killTweensOf(t1);
            TweenMax.killTweensOf(click);

        }
        
        function downHandler(e) {
            t1.interactive=false;
            document.dispatchEvent(new CustomEvent('Game_ScrollIn'));
        }


        return page;
    }
}